#ifndef BUFFER_H
#define BUFFER_H

#include <windows.h>
extern "C"
{
	#include "lua.h"
	#include "lauxlib.h"
	#include "lualib.h"
}

int luaopen_buffer(lua_State * L);

#define TYPENAME_BUFFER "buffer"

class buffer
{
public:
	static int Create(lua_State * L);
	static int PtrToString(lua_State * L);
	static void Reg(lua_State * L);
private:
	static buffer * Push(lua_State * L);
	static int Set(lua_State * L);
	static int Get(lua_State * L);
	static int ToString(lua_State * L);
	static int ToPtr(lua_State * L);
	static int Size(lua_State * L);
	static int Allocate(lua_State * L);
	static int Release(lua_State * L);
	static int FlipImage(lua_State * L);
	size_t sz;
	byte * ptr;
};

#endif